<!-- 基本资料 -->
<template>
  <div>
    <PimNavBar></PimNavBar>
    <PimPersonalCenter></PimPersonalCenter>
    <van-tabs v-model="navactive">
      <van-tab title="基本资料" :to="{name: 'PimRecord' } "></van-tab>
      <van-tab title="企业信息" :to="{name: 'PimRecord2'}"></van-tab>
      <van-tab title="账户安全" :to="{name: 'PimRecord3'}"></van-tab>
      <van-tab title="一般纳税人" :to="{name: 'PimRecord4'}"></van-tab>
    </van-tabs>
    <!-- <PimRecord></PimRecord> -->
    <div class="marginTop">
      <router-view></router-view>
    </div>

    <PimTabBar></PimTabBar>
  </div>
</template>

<script>
import PimNavBar from "./component/PimNavBar";
import PimPersonalCenter from "./component/PimPersonalCenter";
import PimRecord from "./component/PimRecord";
import PimRecord2 from "./component/PimRecord2";
import PimRecord3 from "./component/PimRecord3";
import PimRecord4 from "./component/PimRecord4";
import PimTabBar from "./component/PimTabBar";
export default {
  data() {
    return {
      navactive: 0
    };
  },
  methods: {
    navpath() {
      if (this.$route.path == "/pim/pimrecord2") {
        this.navactive = 1;
        console.log(this.$route.path, 321312);
      } else if (this.$route.path == "/pim/pimrecord3") {
        this.navactive = 2;
      } else if (this.$route.path == "/pim/pimrecord4") {
        this.navactive = 3;
      } else {
        this.navactive = 0;
      }
    }
  },
  components: {
    PimNavBar,
    PimPersonalCenter,
    PimRecord,
    PimRecord2,
    PimRecord3,
    PimRecord4,
    PimTabBar
  },
  watch: {
    $route(to, from) {
      if (to.path == "/pim/pimrecord2") {
        this.navactive = 1;
      } else if (to.path == "/pim/pimrecord3") {
        this.navactive = 2;
      } else if (to.path == "/pim/pimrecord4") {
        this.navactive = 3;
      } else {
        this.navactive = 0;
      }
      // console.log(to, from);
      // console.log(to.path == "/pim/pimrecord2");
    }
  },
  created() {
    this.navpath();
  }
};
</script>
<style lang='scss' scoped>
.clickcolor {
  border-bottom: #ff9000 solid 2px;
}
.marginTop {
  margin-top: 20px;
}
</style>